﻿using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ExplorerService.Common.ServiceContracts;

namespace ExplorerService.Common.DataContracts.Operations
{
    /// <summary>
    /// Class used to group requests together in a single operation
    /// </summary>
    [DataContract]
    public class Operation
    {
        /// <summary>
        /// Gets/Sets the session ID for the application that performs the operation
        /// </summary>
        [DataMember]
        public Guid ApplicationSessionId { get; set; }

        /// <summary>
        /// Gets/Sets the session ID for the client that sent the operation
        /// </summary>
        [DataMember]
        public Guid ClientSessionId { get; set; }

        /// <summary>
        /// Operation ID
        /// </summary>
        [DataMember]
        public Guid Id { get; set; }

        /// <summary>
        /// List of requests to execute (in their order)
        /// </summary>
        [DataMember]
        public List<RequestBase> OperationsToExecute { get; set; }

        /// <summary>
        /// Stores the delivery state of the operation
        /// </summary>
        public bool Sent { get; set; }

        /// <summary>
        /// Stores the callback used to post operation progress
        /// </summary>
        public IClientOperationServiceCallback OperationCallback { get; set; }


        /// <summary>
        /// Flag used for cancel pending
        /// </summary>
        public bool CancelPending
        {
            get;
            set;
        }
    }
}
